<?php
/**
* Handles all database functions for locations
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @version 11-08-05
* @package DBEngine
*
* Copyright (C) 2003 - 2007 phpScheduleIt & 2010 ITOxygen
* License: GPL, see LICENSE
*/

$basedir = dirname(__FILE__) . '/../..';

include_once($basedir . '/lib/DBEngine.class.php');

/**
* Provide all access to database to manage reservations
*/
class DepartmentDB extends DBEngine {
	
	/**
	* 
	*/

  function getDepartment($id) {	
		$query = 'SELECT * FROM ' . $this->get_table('departments') . ' WHERE deptid=?';

		$result = $this->db->getRow($query, array($id));
		$this->check_for_error($result);
		
		if (count($result) <= 0) {
			$this->err_msg = translate('That record could not be found.');
			return false;
		}
		
		return $this->cleanRow($result);
	}


	function getDepartments() {
		$return = array();
		
		$query = 'SELECT * FROM ' . $this->get_table('departments');
			
		
		$result = $this->db->query($query, array($id));
		$this->check_for_error($result);
		
		while ($rs = $result->fetchRow()) {
			$return[] = $this->cleanRow($rs);
			echo $this->cleanRow($rs) . "\n";
		}
		
		$result->free();	
		return $return;
	}
	
	
}
?>
